#include<stdio.h>
#include<string.h>

int main()
{
	int length = 0;
	char character = 0, str[50000] = {0};
	
	scanf("%d %c", &length, &character);
	getchar();
	gets(str);
	
	int lens = strlen(str);
	
	int i;
	if(lens >= length)
	{
		for(i = lens-length; i < lens; i++)
		{
			printf("%c", str[i]);
		}
	}
	else
	{
		for(i = 0; i < length - lens; i++)
		{
			printf("%c", character);
		}
		puts(str);
	}
	
	return 0;
}
